<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {$LOAD_STYLE.top|raw}
</head>
<script src="__JS__/clipboard.min.js"></script>
	<body class="pear-container">
		{if $cusid==0}
		<div class="layui-card">
			<div class="layui-card-body">
				<form class="layui-form layui-form-pane" action="">
					<div class="layui-form-item">
                           
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">客户昵称</label>
                   <div class="layui-input-inline">
                       <input type="text" name="name" placeholder="" class="layui-input">
                   </div>
               </div>
                        <div class="layui-form-item layui-inline">
                       <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="query">
                           <i class="layui-icon layui-icon-search"></i>
                           查询
                       </button>
                       <button type="reset" class="pear-btn pear-btn-md">
                           <i class="layui-icon layui-icon-refresh"></i>
                           重置
                       </button>
                       </div>
                    </div>
				</form>
			</div>
		</div>
		{/if}
		<div class="layui-card">
			<div class="layui-card-body">
				<table id="dataTable" lay-filter="dataTable"></table>
			</div>
		</div>

		<script type="text/html" id="toolbar">
			<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
		        <i class="layui-icon layui-icon-add-1"></i>
		        新增
			</button>
			<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
		        <i class="layui-icon layui-icon-delete"></i>
		        删除
		    </button>
            <button class="pear-btn pear-btn-md" lay-event="recycle">
		        <i class="layui-icon layui-icon-delete"></i>
		        回收站
		    </button>
		</script>

		<script type="text/html" id="gettype">
			{{# if(d.gettype==0){ }}
			<span>店取</span>
			{{# }else{ }}
			<span>邮寄</span>
			{{# } }}
		</script>

        <script type="text/html" id="customer">
		<div copy="{{d.customer.name}},{{d.customer.phone}},{{d.customer.address2}}">
			<a href="javascript:;" title="点击复制客户地址信息">{{ d.customer.name }}
			{{# if(d.customer.company!=''){ }} | {{ d.customer.company }} {{# } }}
			</a>
		</div>
		</script>

		<script type="text/html" id="options">
		<div class="layui-options">
			<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
			{{# if(d.card!=''){ }}
			<button class="pear-btn pear-btn-yellow pear-btn-sm" lay-event="pop" url="{:U('cloth.main/label')}/type/sample/id/{{d.id}}" poptitle="产品标签"><i class="pear-icon pear-icon-print"></i></button>
			{{# } }}
		    <button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
		</div>
		</script>
        <script>
        layui.use(['jquery','common','mycomm','table'], function() {
            let $ = layui.jquery;
			let common = layui.common;
			let mycomm = layui.mycomm;
			let table = layui.table;
			let $table_name = "dataTable";
            let MODULE_PATH = "{$MODULE_PATH}";
			            
            
            let cols = [
                [{
                        type: 'checkbox'
				   }, {
                       field: "create_time",
                       title: "添加时间",
					   width: 130,
                       unresize: "true",
                       align: "center"
                   }, {
                       field: "cus_name",
                       title: "客户昵称",
                       unresize: "true",
					   templet: "#customer",
                       align: "left"
                   }, {
                       field: "gettype",
                       title: "索取色卡方式",
					   width: 80,
                       unresize: "true",
					   templet: "#gettype",
                       align: "center"
                   }, {
                       field: "card",
                       title: "色卡编号",
                       unresize: "true",
                       align: "left"
                   }, {
                       field: "sample",
                       title: "剪样色号",
                       unresize: "true",
                       align: "left",
                   }, {
                       field: "remark",
                       title: "备注信息",
                       unresize: "true",
                       align: "left"
                   }, {
                        title: '操作',
                        toolbar: '#options',
                        unresize: true,
                        align: 'left',
                        width:180,
                    }
                ]
            ]
			
			table.render({
				elem: '#dataTable',
				url: MODULE_PATH + 'index',
				where:{cusid:{$cusid}},
				page: true,
				cols: cols,
				cellMinWidth: 100,
				even: true,
				limit: 30,
				toolbar: '#toolbar',
				defaultToolbar: [{
					title: '刷新',
					layEvent: 'refresh',
					icon: 'layui-icon-refresh',
				}, 'filter', 'print', 'exports'],
			});
			
			mycomm.tableTool('{$controller_title}',MODULE_PATH,$table_name);
			mycomm.tableToolBar('{$controller_title}',MODULE_PATH,$table_name);
			mycomm.search_table($table_name);

        })
    </script>
	{$LOAD_STYLE.bottom|raw}
	</body>
</html>
